#include "stdafx.h"
#include "ServerPacketHandler.h"

#include <Game/Message.h>
#include <Network/TcpPacket.h>

ServerPacketHandler::ServerPacketHandler(void)
{
}

ServerPacketHandler::~ServerPacketHandler(void)
{
}

void ServerPacketHandler::OnConnected(TcpConnection* connection, int error)
{
	connections_.insert(connection);
}

void ServerPacketHandler::OnClosed(TcpConnection* connection, int error)
{
	connections_.erase(connection);
}

void ServerPacketHandler::OnSent(TcpConnection*, int error)
{
}

void ServerPacketHandler::OnReceived(TcpConnection* connection, TcpPacket* packet, int error)
{
	if( MSG_LOGIN == packet->messageId_ )
	{
		msg_login_rq* rq = (msg_login_rq*)packet->payload_;
		OnLogin(rq->userId);
	}
	else if( packet->messageId_ )
	{
	}
}

